home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.11 Nov 90 / FKEY Source Code / Selection Sort / ToolSort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-03  |  1.6 KB  |  53 lines  |  [TEXT/KAHL]

  1. #ifndef _ToolSort_
  2. #define _ToolSort_
  3.  
  4. #include <stdio.h>
  5.  
  6. #define    NIL                0L
  7.  
  8. #define No_Error        0
  9. #define    End_Error        1    /* Selection must end with a carriage return. */
  10. #define Type_Error        2    /* No selection of type 'TEXT' in scarp. */
  11. #define Memory_Error     4    /* Not enough memory. */
  12. #define Nil_Hand_Error     8    /* Nil Handle Error. */
  13. #define Empty_Error     16    /* No selection, scrap empty. */
  14. #define Sys_Error        32    /* A system error, probably relating to the filing system. */
  15. #define Scrap_Error        64    /* Error writing desk scrap. */
  16. #define TEScrap_Error    128    /* Error writing writing TEScrap. */
  17.  
  18. #define    DESK_SCRAP    0        /* To get input from the desk scrap set 
  19.                                DESK_SCRAP to 1.  If input is from 
  20.                                TEScrap set DESK_SCRAP to 0.       */
  21. #define alertID     2
  22.  
  23. typedef struct SelLineRec
  24.     {
  25.     int        noLines;
  26.     Handle    *lines;        /* array of Handles of lines of text */
  27.     } SelLine;
  28.  
  29. typedef struct SelRec
  30.     {
  31.     long    length;        /* length of selection */
  32.     Handle    sel;        /* handle to selection */
  33.     } SelRec;
  34.  
  35. typedef    Handle Text;
  36.  
  37.  
  38. /******************* Function Prototypes ******************************/
  39.  
  40. int Bubble(void *elem, int big, int num, int (*comp)(), int (*set)() ); 
  41. int BuildLines( SelRec validSel, SelLine * selLine );
  42. int Comp( Handle *e1, Handle* e2 );
  43. int DisplayError(unsigned int err);
  44. int GetValidSel(SelRec *validSel);
  45. int SelToText( SelLine sortSel, Text *txt );
  46. int Set( Handle *e1, Handle* e2 );
  47. int ShellSort(void *elem, int big, int num, int (*comp)(), int (*set)() ); 
  48. int Swap( Handle *e1, Handle* e2 );
  49. int UpdateSel( Handle txt );
  50. long GetSel( Handle *sel );
  51. void main(void);
  52.  
  53. #endif